For sampled-sound data that is more complex than a standard sound header can describe, the Sound Manager uses an extended sound header record. Sound data described by such a header can be monophonic or stereo, but it cannot be compressed.
Most of the fields of the extended sound header correspond to fields of the sampled sound header. However, the extended sound header allows the encoding of stereo sound. The numChannels field contains the number of channels of sound recorded, and the numFrames field contains the number of frames of sound recorded in each channel. For more information on the format of sampled sound frames, see "Sound Files" .
The word "channel" can be confusing in this context, because a sound resource containing polyphonic sound (that is, multichannel sound) can be played on a single Sound Manager sound channel. Channel is a general term for the portion of sound data that can be described by a single sound wave. Monophonic sound is composed of a single channel. Stereo sound (also called polyphonic sound ) is composed of several channels of sound played simultaneously. "Sound channel" is a term specific to the Sound Manager.
TYPE ExtSoundHeader =
PACKED RECORD
samplePtr: Ptr; {if NIL, samples in sampleArea}
numChannels: LongInt; {number of channels in sample}
sampleRate: Fixed; {rate of original sample}
loopStart: LongInt; {loop point beginning}
loopEnd: LongInt; {loop point ending}
encode: Byte; {sample's encoding option}
baseFrequency: Byte; {base freq. of original sample}
numFrames: LongInt; {total number of frames}
AIFFSampleRate: Extended80; {rate of original sample}
markerChunk: Ptr; {reserved}
instrumentChunks: Ptr; {pointer to instrument info}
AESRecording: Ptr; {pointer to audio info}
sampleSize: Integer; {number of bits per sample}
futureUse1: Integer; {reserved}
futureUse2: LongInt; {reserved}
futureUse3: LongInt; {reserved}
futureUse4: LongInt; {reserved}
sampleArea: PACKED ARRAY[0..0] OF Byte;
END;
To compute the total number of bytes of a sample, multiply the values in the numChannels , numFrames , and sampleSize fields and divide by the number of bytes per sample (typically 8 or 16).
Although extended sound headers (and compressed sound headers, described next) support the storage of 16-bit sound, only versions 3.0 and later of the Sound Manager can play 16-bit sounds. If your application uses 16-bit sound, you must convert it to 8-bit sound before earlier versions of the Sound Manager can play it.
| Previous | Chapter contents | Chapter top | Section top | Next |